package com.fz.controller;

import com.alibaba.fastjson.JSONObject;
import com.fz.entity.Student;
import javafx.scene.chart.PieChart;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by "鐤媯鐨勭爜宸�" on 2017-09-06.
 *
 */
/*json返回是一个字符串*/
@Controller
@RequestMapping("/jso")
public class Json {
    @RequestMapping("/nn")
    @ResponseBody
    public String aa(){
 String[] s=new String[]{"df","sdf","213","978","oe"};
    return JSONObject.toJSONString(s);
    }
    @RequestMapping("/n")
    @ResponseBody
    public String bb(){
        Student s=new Student();
        s.setSaddress("dsfsdf");
        s.setScore(50);
        s.setSname("lalla");
        return JSONObject.toJSONString(s);
    }
    @RequestMapping(value ="/tt",method = RequestMethod.POST)
    @ResponseBody
    public String cc(){
     return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
    }
}
